package com.snopy.database.redis;

import lombok.extern.slf4j.Slf4j;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * @author snopy
 * @version 1.0.0
 * @classname GenerateMassInsertionTxt
 * @description
 * @email 77912204@qq.com
 * @date 2022/02/27 18:28
 */
@Slf4j
public class GenerateMassInsertionTxt {
    public static void main(String[] args) throws IOException {
        File file = new File("E:\\data.txt");
        if (!file.exists()){
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        OutputStream outputStream = null;
        try {
            outputStream = new FileOutputStream(file);
            for (int i=0;i<1000000;i++){
                outputStream.write((" SET " + "K" + i + " " + "V" + i+"\n").getBytes(StandardCharsets.UTF_8));
            }
            outputStream.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (outputStream!=null){
                outputStream.close();
            }
        }

    }
}

